package com.principle.inversion;

public class DependencyPass {
    public static void main(String[] args) {

    }
}
//方式3：通过setter方法实现依赖传递
//开关的接口
interface IOpenAndClose{
    public void open();//抽象方法
    public void setTv(ITV tv);
}
interface ITV{//ITV接口
    public void play();
}
//实现接口
class OpenAndClose implements IOpenAndClose{
    public ITV tv;
    public void setTv(ITV tv){
        this.tv=tv;
    }
    public void open(){
        this.tv.play();
    }
}